package simpSync.model;

import javafx.scene.layout.Pane;

/**
 * Repesenta um região do modelo SimpSync
 */
public class Region {

    private String id;
    private String width;
    private String height;
    private String left;
    private String top;
    private String zIndex;
    private String bgcolor;
    private Pane paneContent;

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the width
     */
    public String getWidth() {
        return width;
    }

    /**
     * @param width the width to set
     */
    public void setWidth(String width) {
        this.width = width;
    }

    /**
     * @return the height
     */
    public String getHeight() {
        return height;
    }

    /**
     * @param height the height to set
     */
    public void setHeight(String height) {
        this.height = height;
    }

    /**
     * @return the left
     */
    public String getLeft() {
        return left;
    }

    /**
     * @param left the left to set
     */
    public void setLeft(String left) {
        this.left = left;
    }

    /**
     * @return the top
     */
    public String getTop() {
        return top;
    }

    /**
     * @param top the top to set
     */
    public void setTop(String top) {
        this.top = top;
    }

    /**
     * @return the zIndex
     */
    public String getzIndex() {
        return zIndex;
    }

    /**
     * @param zIndex the zIndex to set
     */
    public void setzIndex(String zIndex) {
        this.zIndex = zIndex;
    }

    public void draw(Pane pane) {

        Pane regionPane = new Pane();
        regionPane.setId(getId());
        regionPane.setPrefWidth(Double.parseDouble(getWidth()));
        regionPane.setPrefHeight(Double.parseDouble(getHeight()));
        regionPane.setLayoutX(Double.parseDouble(getLeft()));
        regionPane.setLayoutY(Double.parseDouble(getTop()));
        if (!getBgcolor().equals("")) {
            regionPane.setStyle("-fx-background-color: " + getBgcolor() + ";");
        }

        setPaneContent(regionPane);

        pane.getChildren().add(regionPane);

    }

    /**
     * @return the bgcolor
     */
    public String getBgcolor() {
        return bgcolor;
    }

    /**
     * @param bgcolor the bgcolor to set
     */
    public void setBgcolor(String bgcolor) {
        this.bgcolor = bgcolor;
    }

    public Pane getPaneContent() {
        return paneContent;
    }

    public void setPaneContent(Pane paneContent) {
        this.paneContent = paneContent;
    }
}
